import Vue from 'vue'
import VueRouter from 'vue-router'
//import Layout from '../views/layout/index.vue'
import Layout from '../views/layout';

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    meta: {title:"首页"},
    component: Layout,
    redirect: "/home",//重定向
    children: [
      {
        path: "home",
        meta: {title:"首页"},
        name: "myhome",
        component: () => import(/* webpackChunkName: "home" */ '../views/home/index.vue')
      }
    ]
  },
  {
    path: '/pms',
    name: 'pms',
    meta: {title:"商品"},
    component: Layout,
    redirect: "/pms/product",//重定向
    children: [
      {
        path: "product",
        name: "product",
        meta: {title:"商品列表"},
        component: () => import(/* webpackChunkName: "product" */ '../views/pms/product/index.vue')
      },
      {
        path: "productadd",
        name: "productadd",
        meta: {title:"添加商品"},
        component: () => import(/* webpackChunkName: "productadd" */ '../views/pms/productadd/add.vue')
      },
      {
        path: "productAttr",
        name: "productAttr",
        meta: {title:"商品类型"},
        component: () => import(/* webpackChunkName: "productAttr" */ '../views/pms/productAttr/index.vue')
      },
      {
        path: "productCate",
        name: "productCate",
        meta: {title:"商品分类"},
        component: () => import(/* webpackChunkName: "productCate" */ '../views/pms/productCate/index.vue')
      },
      {
        path: "productCateAdd",
        name: "productCateAdd",
        meta: {title:"添加商品分类"},
        component: () => import(/* webpackChunkName: "productCateAdd" */ '../views/pms/productCate/add.vue')
      },
      {
        path: "brand",
        name: "brand",
        meta: {title:"商品品牌"},
        component: () => import(/* webpackChunkName: "brand" */ '../views/pms/brand/index.vue')
      },

    ]
  },


  {
    path: '/login',
    name: 'Login',
    meta: { title: "登录" },
    component: () => import(/* webpackChunkName: "login" */ '../views/login')
  },
  {
    path: '*',
    name: 'page404',
    component: () => import(/* webpackChunkName: "page404" */ '../views/page404')
  }
]

const router = new VueRouter({
  routes
})

export default router
